// hyb_yl/mycenter/pages/extenOrgan/extenOrgan.js
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    id:"",
    array: ['医院', '药房', '体检机构','诊所','养生会所','慢病管理中心'],
    index: 0,
    date: '加入时间',
    organlist: [],
    list:[],
    groupid:'',
    page:0,

  },
  bindPickerChange: function (e) {
    this.setData({
      index: e.detail.value
    })
    this.setData({
      groupid:parseInt(e.detail.value)+1,
      list:[],
      page:0
    })
    this.getList();
  },
  bindDateChange: function (e) {
    this.setData({
      date: e.detail.value,
      list:[],
      page:0
    })
    this.getList();
    console.log(this.data.date)
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    that.setData({
      id:options.id
    })
    that.getList();
  },
  getList:function(){
    var that = this;
    app.util.request({
      'url': 'entry/wxapp/tuike.hospital',
      data: {
        openid:wx.getStorageSync('openid'),
        id:that.data.id,
        groupid:that.data.groupid,
        date:that.data.date,
        page:that.data.page,
      },
      success: function (res) {
        console.log(res)
        var page = that.data.page + 1;
        that.setData({
          list:that.data.list.concat(res.data),
          page:page
        })
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    this.getList();
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})